package cn.kgc.crowdfundingadminspringboot2.common;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ExceptionHandler;

public class CrowdFundingConstant {
        public static final String ATTR_NAME_MESSAGE = "MESSAGE";
        public static final String ATTR_NAME_ERROR_MESSAGE = "ERROR-MESSAGE";
        public static final String ATTR_NAME_LOGIN_ADMIN = "LOGIN-ADMIN";
        public static final String ATTR_NAME_PAGE_INFO = "PAGE-INFO";
        public static final String ATTR_ADMIN = "ADMIN";
        public static final String MESSAGE_LOGIN_FAILED = "登录账号或密码不正确！请核对后再登录！";
        public static final String MESSAGE_CODE_INVALID = "明文不是有效字符串，请核对后再操作！";

    @ExceptionHandler(value=Exception.class)
    public String catchException(Exception exception,Model model) {
        model.addAttribute(CrowdFundingConstant.ATTR_NAME_ERROR_MESSAGE, exception.getMessage());
        return "system-error";
    }
}
